package lec14dfs;

import java.util.Arrays;

public class SubSetApp {
    public static void main(String[] args) {
        int n = 5;
        int[] a = new int[]{1, 2, 3, 4, 5};
        int[] book = new int[n];// 11110

        for (int i = 0; i < (1 << n); i++) {
            for (int j = 0; j < n; j++)
                book[j] = (i >> j) & 1;
            int s = 0;
            for (int j = 0; j < n; j++) {
                if (book[j] == 1)
                    s += a[j];
            }
            if (s == 10) {
                System.err.println(Arrays.toString(book));
            }

        }

    }
}
